import request from '@/utils/request'
import config from '@/config'
// import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from '@/api/types';
const clientId = config.clientID;

export function loadApk({ apkCode }) {
  return request({
    url: '/je/phone/app/loadApk',
    method: 'post',
    data: {
	  apkCode,
    },
  });
}


// 登录方法
export function login(data) {
  let obj = {
	j_username: data.value.j_username,
	j_password: data.value.j_password,
	isNew: data.value.isNew
  }
  return request({
    url: '/rbac/login/login',
    method: 'post',
    params: obj
  });
}

// 加载系统变量
export function loadSysVariables(str) {
  const obj = {
    device: str
  }
  return request({
    url: '/je/sysConfig/sysConfig/loadSysVariables',
    method: 'post',
    params: obj
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/je/rbac/user/getCurrentUserInfo',
    method: 'POST'
  })
}

//注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/auth/code',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取租户列表
export function getTenantList(){
  return request({
    url: '/auth/tenant/list',
    headers: {
      isToken: false
    },
    method: 'get'
  });
}